<?php

/*
 * This file is part of the mivan project.
 *
 * (c) mivan project <http://github.com/mivan>
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

use frontend\components\sms\SmsWidget;
use yii\helpers\Html;
use yii\widgets\ActiveForm;

/**
 * @var yii\web\View              $this
 */

$this->context->layout = '@app/views/layouts/main-security';
$this->title = Yii::t('user', 'Sign up');
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="register-warp">
    <div class="register-bg" style="background-color: #f85316;">
        <div class="register-bg-w">
            <img src="../images/login_left_bg.png" class="left_bg" />
        </div>
    </div>

    <div class="register-w">

        <div class="reg-title">
            免费注册会员
            <span class="pull-right">已有账号？
                <?= Html::a('登录', ['/user/security/login'], ['class'=>'text-primary']) ?>
            </span>
        </div>

        <div class="reg-content">
            <?php $form = ActiveForm::begin([
                'id'                     => 'registration-form',
                'options'                => ['class'=> 'form-horizontal'],
                'enableAjaxValidation'   => true,
                'enableClientValidation' => false
            ]); ?>

            <?= $form->field($model, 'mobile', [
                'inputOptions' => ['placeholder' => '手机号码', 'class' => 'form-control', 'tabindex' => '1'],
                'template' => "<div class=\"input-group\">
                                <div class=\"input-group-addon\">手机号码</div>
                                    {input}
                               </div>
                               {error}"
            ])
            ?>

            <?= $form->field($model, 'code')->widget( SmsWidget::className(), [
                'mobileId' => 'mobile',
                'route' => '/api/sms',
            ])->label(false) ?>

            <?php if ($module->enableGeneratingPassword == false): ?>
            <?= $form->field($model, 'password', [
                'inputOptions' => ['placeholder' => '密码', 'class' => 'form-control', 'tabindex' => '3'],
                'template' => "<div class=\"input-group\">
                                <div class=\"input-group-addon\">设置密码</div>
                                    {input}
                               </div>
                               {error}"
            ])->passwordInput()
            ?>
            <?php endif ?>

            <?= $form->field($model, 'repassword', [
                'inputOptions' => ['placeholder' => '再次输入密码', 'class' => 'form-control', 'tabindex' => '4'],
                'template' => "<div class=\"input-group\">
                                <div class=\"input-group-addon\">确认密码</div>
                                    {input}
                               </div>
                               {error}"
            ])->passwordInput()
            ?>

            <?= $form->field($model, 'isread')->checkbox(['uncheck' => null, 'value'=> null, 'label' => '我同意并已阅读《桌桌服务条款》']) ?>

            <div class="form-group">
                <?= Html::submitButton('立即注册', ['class' => 'btn btn-theme btn-block', 'tabindex' => '5']) ?>
            </div>
            <?php ActiveForm::end(); ?>
        </div>

    </div>
</div>